home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / MDIDLG.PAK / MDIDLG.CPP < prev    next >
C/C++ Source or Header  |  1997-05-06  |  2KB  |  111 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1995, 1995 by Borland International, All Rights Reserved
  4. //
  5. // Filename:    MdiDlg.cpp
  6. //
  7. // Date:        27-Apr-95
  8. //
  9. // Description:
  10. //----------------------------------------------------------------------------
  11. #include <owl/pch.h>
  12. #if !defined(OWL_VALIDATE_H)
  13. # include <owl/validate.h>
  14. #endif
  15. #include "test.h"
  16. #include "MdiDlg.h"
  17.  
  18.  
  19. //
  20. // constructor
  21. //
  22. TMdiDialog::TMdiDialog(TWindow* parent, TResId resId)
  23. :
  24.   TDialog(parent, resId)
  25. {
  26.   Name = new TEdit(this, IDC_NAME);
  27.   Name->SetValidator(new TFilterValidator("A-Za-z. "));
  28.   Phone = new TEdit(this, IDC_PHONE, 14);
  29.   Phone->SetValidator(new TPXPictureValidator("[(###)]###-####", true));
  30.   Number = new TEdit(this, IDC_NUMBER);
  31.   Number->SetValidator(new TRangeValidator(1, 999));
  32.   EnableNumber = new TCheckBox(this, IDC_ENABLENUMBER);
  33.   EnableHelp   = new TCheckBox(this, IDC_ENABLEHELP);
  34. }
  35.  
  36.  
  37. //
  38. // destructor
  39. //
  40. TMdiDialog::~TMdiDialog()
  41. {
  42. }
  43.  
  44.  
  45. //
  46. // SetupWindow
  47. //
  48. void
  49. TMdiDialog::SetupWindow()
  50. {
  51.   TDialog::SetupWindow();
  52.  
  53.   // put new stuff here
  54.   //
  55.   SETUP_HELPCONTEXT(TTestApp, TMdiDialog);
  56. }
  57.  
  58.  
  59. //
  60. // CleanupWindow
  61. //
  62. void
  63. TMdiDialog::CleanupWindow()
  64. {
  65.   // put new stuff here
  66.   //
  67.   CLEANUP_HELPCONTEXT(TTestApp, TMdiDialog);
  68.  
  69.   TDialog::CleanupWindow();
  70. }
  71.  
  72. //
  73. // Response table
  74. //
  75. DEFINE_RESPONSE_TABLE1(TMdiDialog, TDialog)
  76.   EV_COMMAND_ENABLE(IDC_NUMBER, CeNumber),
  77.   EV_COMMAND_ENABLE(IDHELP, CeHelp),
  78. END_RESPONSE_TABLE;
  79.  
  80.  
  81. DEFINE_HELPCONTEXT(TMdiDialog)
  82.   HCENTRY_CONTROL(IDH_DLG_IDC_NAME,   IDC_NAME),
  83.   HCENTRY_CONTROL(IDH_DLG_IDC_PHONE,  IDC_PHONE),
  84.   HCENTRY_CONTROL(IDH_DLG_IDC_NUMBER, IDC_NUMBER),
  85.   HCENTRY_CONTROL(IDH_DLG_IDOK,       IDOK),
  86.   HCENTRY_CONTROL(IDH_DLG_IDCANCEL,   IDCANCEL),
  87.   HCENTRY_CONTROL(IDH_DLG_IDHELP,     IDHELP),
  88. END_HELPCONTEXT;
  89.  
  90.  
  91. //
  92. //
  93. //
  94. void
  95. TMdiDialog::CeNumber(TCommandEnabler& ce)
  96. {
  97.   ce.Enable(EnableNumber->GetCheck() == BF_CHECKED ? true : false);
  98. }
  99.  
  100.  
  101. //
  102. //
  103. //
  104. void
  105. TMdiDialog::CeHelp(TCommandEnabler& ce)
  106. {
  107.   ce.Enable(ToBool(EnableHelp->GetCheck() == BF_CHECKED));
  108. }
  109.  
  110.  
  111.